package top.rainbowecho.gateway.security.authentication.social.qq.connect;

import org.springframework.social.oauth2.AbstractOAuth2ServiceProvider;
import top.rainbowecho.gateway.security.authentication.social.qq.api.Qq;
import top.rainbowecho.gateway.security.authentication.social.qq.api.QqImpl;

/**
 * @author rainbow
 * @since 2019/12/15 17:05
 */
public class QqServiceProvider extends AbstractOAuth2ServiceProvider<Qq> {
    private String appId;

    public static final String AUTHORIZE_URL = "https://graph.qq.com/oauth2.0/authorize";

    public static final String ACCESS_TOKEN_URL = "https://graph.qq.com/oauth2.0/token";

    public QqServiceProvider(String appId, String appSecret) {
        super(new QqOAuth2Template(appId, appSecret, AUTHORIZE_URL, ACCESS_TOKEN_URL));
        this.appId = appId;
    }

    @Override
    public Qq getApi(String accessToken) {
        return new QqImpl(accessToken, this.appId);
    }
}
